<template>
	<el-container>
		<el-header>退号</el-header>
		<el-main>




			<el-row >
				<el-col :span="8">
					<div class="grid-content bg-purple"	 align="right">病历号：</div>
				</el-col>
				<el-col :span="8">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="请输入病历号" v-model="test.patid"></el-input>
					</div>
				</el-col>

				<el-col :span="2" align="center">
					<div>
						<el-button>查询</el-button>
					</div>
				</el-col>
			</el-row>

			<!-- <el-row >
				<el-col :span="8">
					<div class="grid-content bg-purple" align="right">姓名：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="请输入姓名" v-model="test.name"></el-input>
					</div>
				</el-col>
				
				<el-col :span="4">
					<div class="grid-content bg-purple" align="right">序号：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="请输序号" v-model="test.rid"></el-input>
					</div>
				</el-col>				

			</el-row> -->




		
			<el-row >
<!-- 				<el-col :span="8">
					<div class="grid-content bg-purple" align="right">看诊日期：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="看诊日期" v-model="test.watchdate1"></el-input>
					</div>
				</el-col> -->
				<el-col :span="8">
					<div class="grid-content bg-purple" align="right">姓名：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="请输入姓名" v-model="test.name"></el-input>
					</div>
				</el-col>
				
				<el-col :span="4">
					<div class="grid-content bg-purple" align="right">序号：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="请输序号" v-model="test.rid"></el-input>
					</div>
				</el-col>
				<!-- <el-col :span="4">
					<div class="grid-content bg-purple" align="right"	>午别：</div>
				</el-col>
				
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="午别" v-model="test.watchdate2"></el-input>
					</div>
				</el-col> -->
			</el-row>
			
			<el-row >
				<el-col :span="8">
					<div class="grid-content bg-purple" align="right">挂号科室：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="挂号科室" v-model="test.room"></el-input>
					</div>
				</el-col>
				
				<el-col :span="4">
					<div class="grid-content bg-purple" align="right">号别：</div>
				</el-col>
				
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="号别" v-model="test.haobie"></el-input>
					</div>
				</el-col>
			</el-row>	
			
			<el-row >
				<el-col :span="8">
					<div class="grid-content bg-purple" align="right">看诊医生：</div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="看诊医生" v-model="test.doctor"></el-input>
					</div>
				</el-col>
				

			</el-row>



<!-- 			<el-row :gutter="20">
				<el-col :span="10">
					<div class="grid-content bg-purple" align="right">输入密码：</div>
				</el-col>
				<el-col :span="8">
					<div class="grid-content bg-purple" align="center">
						<el-input placeholder="请输入密码" v-model="test.password" show-password></el-input>
					</div>
				</el-col>
			</el-row> -->


			<el-row :gutter="10">
				<el-col :span="24">
					<div class="grid-content bg-purple" align="center">
						<el-button :plain="true" @click="open1">确定退号</el-button>
					</div>
				</el-col>
			</el-row>

		</el-main>



		<el-footer>
			<el-row :gutter=" 20">

				<el-col :span="16">
					<div class="grid-content bg-purple1" align="center"></div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple1">
					</div>
				</el-col>
			</el-row>
		</el-footer>
	</el-container>
</template>

<script>
	import {
		showMsgTitle
	} from '@/utils/api2'
	import {
		showMsgConfirm
	} from '@/utils/api2'
	import {
		getRequest
	} from '@/utils/api2'
	import {
		postRequest
	} from '@/utils/api2'

	export default {
		data() {
			return {
				test: {
					patid: '',
					name: '',
					rid:'',
					watchdate1:'',
					watchdate2:'',
					room:'',
					haobie:'',
					doctor:'',
				}
			}
		},
		mounted: function() {
			var obj = this.$route.query.obj;
			this.test.patid=this.$route.query.obj.patid;
			this.test.name=this.$route.query.obj.name;
			//this.test.rid=this.$route.query.obj.rid;
			//	alert(this.$route.query.obj.rid)
			this.test.watchdate1=this.$route.query.obj.watchdate1;
			this.test.watchdate2=this.$route.query.obj.watchdate2;
			this.test.room=this.$route.query.obj.room;
			this.test.haobie=this.$route.query.obj.haobie;
			this.test.doctor=this.$route.query.obj.doctor;
			let url = "/queryList";
			let _this = this;
			getRequest(url).then(resp => {
				if (resp.status == 200) {
					for (var i = 0; i < resp.data.length; i++) {
						if (this.test.patid == resp.data[i].patid) {
							//alert('操作成功4');
							this.test.rid=resp.data[i].rid;						
						}
					}
				} else {
					_this.$message({
						type: 'error',
						message: '数据加载失败!'
					});
				}
			}, resp => {
				_this.loading = false;
				if (resp.response.status == 403) {
					_this.$message({
						type: 'error',
						message: resp.response.data
					});
				} else {
					_this.$message({
						type: 'error',
						message: '数据加载失败!'
					});
				}
			}).catch(resp => {
				//压根没见到服务器
				_this.loading = false;
				_this.$message({
					type: 'error',
					message: '数据加载失败!'
				});
			});
		},
		methods: {
			open1() {
				postRequest('/deleteList', this.test);
				this.$message({
					showClose: true,
					message: '退号成功！',
					type: 'success'
				});
			}
		}
	}
</script>
<style>
	.el-header,
	.el-footer {
		background-color: #4fc1b0;
		color: #ffffff;
		text-align: left;
		line-height: 60px;
		font-size: 50px;
	}

	.el-main {
		background-color: #ffffff;
		color: #333;
		text-align: left;
		line-height: 10px;
		font-size: 30px;
	}

	.el-row {
		margin-bottom: 20px;

		&:last-child {
			margin-bottom: 0;
		}
	}

	.el-col {
		border-radius: 4px;
	}

	.grid-content {
		border-radius: 4px;
		min-height: 36px;
	}
</style>
